<?php
$SQL[] = "CREATE TABLE ".SQL_PREFIX."market_taxes (
  t_id int(11) NOT NULL auto_increment,
  applying enum('post','hand') NOT NULL default 'post',
  t_week tinyint(4) NOT NULL default '0',
  t_day tinyint(4) NOT NULL default '0',
  t_hour tinyint(4) NOT NULL default '0',
  t_minute tinyint(4) NOT NULL default '0',
  tax_fix bigint(20) NOT NULL default '0',
  tax_percent float(15,10) NOT NULL default '0.0000000000',
  tax_pmin bigint(20) NOT NULL default '0',
  tax_psub bigint(20) NOT NULL default '0',
  range_min bigint(20) NOT NULL default '0',
  range_max bigint(20) NOT NULL default '0',
  PRIMARY KEY  (t_id)
);";

$SQL[] = "CREATE TABLE ".SQL_PREFIX."market_tax_logs (
  l_id int(11) NOT NULL auto_increment,
  member_id mediumint(9) NOT NULL default '0',
  tax_id int(11) NOT NULL default '0',
  amount bigint(20) NOT NULL default '0',
  l_time int(11) NOT NULL default '0',
  PRIMARY KEY  (l_id)
);";

if ( ipsRegistry::DB()->checkForTable( 'market_quizzes' ) )
{
	$SQL[] = "CREATE TABLE ".SQL_PREFIX."market_quiz_sessions (
  session_id varchar(32) NOT NULL,
  quiz_id int(10) NOT NULL default '0',
  member_id mediumint(8) NOT NULL default '0',
  time_started int(10) NOT NULL default '0',
  PRIMARY KEY (session_id),
  KEY seesion (quiz_id,member_id)
);";
}

$SQL[] = "ALTER TABLE members ADD market_tax float(15,10) NOT NULL DEFAULT 0.0000000000";

$SQL[] = "ALTER TABLE groups ADD g_market_tax float(15,10) NOT NULL DEFAULT 0.0000000000";

$SQL[] = "ALTER TABLE market_categories ADD cat_order smallint NOT NULL DEFAULT 0";

$SQL[] = "ALTER TABLE market_inventory ADD expired int NOT NULL DEFAULT 0";
$SQL[] = "ALTER TABLE market_items ADD expire_time int NOT NULL DEFAULT 0";
$SQL[] = "ALTER TABLE market_items ADD expire_unit int NOT NULL DEFAULT 0";
$SQL[] = "ALTER TABLE market_items ADD settings text NOT NULL";
$SQL[] = "ALTER TABLE market_items ADD limit_buy text NOT NULL";
$SQL[] = "ALTER TABLE market_items ADD limit_use text NOT NULL";

if ( ipsRegistry::DB()->checkForTable( 'market_auction_item' ) )
{
	$SQL[] = "ALTER TABLE market_auction_item ADD expired int NOT NULL DEFAULT 0";
}

if ( ipsRegistry::DB()->checkForTable( 'market_user_store_item' ) )
{
	$SQL[] = "ALTER TABLE market_user_store_item ADD expired int NOT NULL DEFAULT 0";
}

if ( ipsRegistry::DB()->checkForTable( 'market_transfer_logs' ) )
{
	$SQL[] = "ALTER TABLE market_transfer_logs ADD l_anon tinyint NOT NULL DEFAULT 0";
}

?>
